package com.emm.yixun.common.model.enums;

import org.apache.commons.lang.StringUtils;
public enum LevelEnum {
	LevelEnum_1("PROJECT", "1"), 
	LevelEnum_2("PREMISES", "2"), 
	LevelEnum_3("BUILDING", "3"), 
	LevelEnum_4("UNIT", "4"),
	LevelEnum_5("ROOM","5"),
	LevelEnum_6("CARAREA","6"),
	LevelEnum_7("CARPORT","7");
	

	private String code;

	private String name;

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	private LevelEnum(String code, String name) {
		this.code = code;
		this.name = name;
	}

	private LevelEnum() {
	}

	public static LevelEnum getByNo(String no) {
		if (StringUtils.isBlank(no)) {
			return null;
		}
		for (LevelEnum menum : values()) {
			if (menum.getCode().equals(no)) {
				return menum;
			}
		}
		return null;
	}
	public static void main(String[] args) {
		String str = "PROJECT_12";
		System.out.println(str.subSequence(0, str.indexOf("_")));
		System.out.println(str.subSequence(str.indexOf("_")+1, str.length()));
	}
}
